<?php
/**
 * Skill widget's content
 * @author Toan Nguyen
 * User edit their skills and set the level of this skills.
 */
$user = elgg_get_page_owner_entity();

$userSkills = elgg_get_entities(array(
		'type'		=>"object",
		'subtype'	=>"UserSkill",
		'owner_guid'=>$user->guid,
));
echo "<div>";
//echo "<h5>";
//echo elgg_echo("skill:widget:subtitle");
//echo "</h5>";
echo "<table style='width:100%'>";
if(count($userSkills) == 0){
	echo "<h5>There is not any skill was added!</h5>";
}
foreach ($userSkills as $skillValue){

	echo "<tr>
			<th class='user_skills' >
			<div class='skill_name'>
				<h4 class='tooltip' title=".$skillValue->title.">".$skillValue->title."</h4>
				<span class='more_info'></span>
			</div></th>
					<th class='user_skills'>";
	echo elgg_view("elggx_fivestar/voting",
			array('entity' => $skillValue,
					'min' => true,
					'subclass' => 'inline',
					'outerId' => 'skill_star',
					'ratingTextClass' => 'skill_start'));
	echo "</th></tr>";
}
echo "</table><hr>";
echo "</div>";
echo "<div class='right'>";

if(elgg_get_logged_in_user_guid() == $user->guid){
	echo elgg_view("output/url",array(
			"text" => elgg_echo('skill:edit'),
			"href" => $vars["url"] . "skill/forms/usereditskill",
			"class" => "elgg-lightbox right user_skills",
	));
	if(elgg_is_admin_logged_in()){
		echo elgg_view("output/url",array(
				"text" => elgg_echo('skill:newskill:title'),
				"href" => $vars["url"] . "skill/forms/newskillLB",
				"class" => "elgg-lightbox right user_skills",
		));
	}
}
echo "</div>";
?>
<script>

</script>

<style>
.right {
float: right;
}
.skill_name{
	width: 120px;
}
.user_skills {
	padding: 5px;
}

#skill_star {
	padding-left: 30px;
}
</style>
